package cn.zyjblogs.server.authority.po;

import cn.zyjblogs.starter.common.entity.constant.CommonConstant;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author zhuyijun
 */
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@TableName("permission_resources")
public class PermissionResourcesPo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自行设置
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    /**
     * 权限资源编码
     */
    @TableField("code")
    private String code;

    /**
     * 名称
     */
    @TableField("name")
    private String name;


    /**
     * 父记录主键，uuid
     */
    @TableField("parent_id")
    private String parentId;
    /**
     * 资源类型 0页面 1 按钮
     */
    @TableField("resource_type")
    private Integer resourceType;

    /**
     * 描述
     */
    @TableField("description")
    private String description;

    /**
     * 前端是否可见：0 隐藏，1 显示
     */
    @TableField("ui_show")
    private Integer uiShow;

    /**
     * 前端用路径
     */
    @TableField("ui_path")
    private String uiPath;

    /**
     * 前端用编码
     */
    @TableField("ui_code")
    private String uiCode;

    /**
     * 前端用排序
     */
    @TableField("ui_sort")
    private Integer uiSort;

    /**
     * 前端用模板
     */
    @TableField("ui_template")
    private String uiTemplate;
    /**
     * 前端面包屑，1显示 0不显示
     */
    @TableField("ui_is_show_breadcrumb")
    private Integer uiIsShowBreadcrumb;

    /**
     * 创建时间
     */
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JSONField(format = CommonConstant.DATETIME_PATTERN)
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 最后修改的时间
     */
    @JSONField(format = CommonConstant.DATETIME_PATTERN)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @TableField("edit_time")
    private LocalDateTime editTime;

}
